package com.distribution.system.domain.converter;


import com.distribution.system.domain.dto.CmccDaCommissionReflectionDto;
import com.distribution.system.domain.req.CommissionReflectionListReq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.time.LocalDateTime;
import java.util.Objects;

@Mapper(componentModel = "spring", imports = {LocalDateTime.class, Objects.class})
public interface CommissionReflectionConverter {
    @Mapping(target = "beginTime", expression = "java(Objects.isNull(commissionReflectionListReq.getBeginTime()) ? null : LocalDateTime.parse(commissionReflectionListReq.getBeginTime()))")
    @Mapping(target = "endTime", expression = "java(Objects.isNull(commissionReflectionListReq.getEndTime()) ? null : LocalDateTime.parse(commissionReflectionListReq.getEndTime()))")
    CmccDaCommissionReflectionDto commissionReflectionListReqToDto(CommissionReflectionListReq commissionReflectionListReq);

}
